"""
-*- coding:utf-8 -*-
最终版web自动化
Author: Free
DataTime: 2020/1/18 10:21

"""
import enum
import os
import configparser


# TODO 测试正式备机进行选择
class ReadConfig(enum.Enum):
    # 正式服
    # url_first = 'https://www.bjex.pro/#/index'
    # url_bibi = 'https://www.bjex.pro/#/tradeCenter'
    # url_login = 'https://www.bjex.pro/#/login'
    # 备机
    # url_first = 'http://192.168.0.53:881/#/index'
    # url_bibi = 'http://192.168.0.53:881/#/tradeCenter'
    # url_login = 'http://192.168.0.53:881/#/login/'
    # 测试
    url_first = 'http://192.168.0.53:81/#/index'
    url_bibi = 'http://192.168.0.53:81/#/tradeCenter'
    url_login = 'http://192.168.0.53:81/#/login/'
    url_forget = 'http://192.168.0.53:81/#/user/retrievePassword'
    url_register = 'http://192.168.0.53:81/#/user/regist'
    url_history = 'http://192.168.0.53:81/#/personalcenter/rechargeWithdrawCoinRecord'
    # 备机用户名
    # user = 'free@bjex.com'
    # password = 'bjex1234'
    # 测试用户名
    user = '09958726736'
    password = '000000'
    # 使用的浏览器
    browserName = 'CHROME'


class ConfigTool(object):
    def __init__(self):
        self.conf = configparser.ConfigParser()

    @staticmethod
    def get_current_path():
        return os.path.dirname(os.path.realpath(__file__))

    def build_path(self, config_path):
        self.conf.read(config_path)

    def get(self, area, key):
        return self.conf.get(area, key)
